<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'changeQuestion.jsp' starting page</title>
<style type="text/css">
.STYLE6 {
color:#FFFFFF;
font-size:13px;
}
.STYLE7 {
color:#336699;
font-family:"Arial","宋体";
font-size:12px;
line-height:130%;
}
body {
	background-image: url(images/bg2.gif);
	background-repeat: repeat;
}
</style>
	<script src="js/jquery.js"></script>
	<script src="js/public.js"></script>
	<script type="text/javascript">
function checkQuestion1() {
		var question1 = $("#question1").val();
		if(question1.length>0){
			$("#font8").attr("color","green");
			$("#font8").html("<img src=\"images/check_right.gif\"/>&nbsp;");
		}else{
			$("#font8").attr("color","red");
			$("#font8").html("<img src=\"images/check_error.gif\"/>&nbsp;请输入您的第一个提示问题");
		}
	}
	function checkAnaswer1(){
		var answer1 = trim($("#answer1").val());
		if(answer1.length>0){
			$("#font9").attr("color","green");
			$("#font9").html("<img src=\"images/check_right.gif\"/>&nbsp;");
		}else{
			$("#font9").attr("color","red");
			$("#font9").html("<img src=\"images/check_error.gif\"/>&nbsp;请输入您的答案");
		}
	}
	function checkQuestion2() {
		var question2 = trim($("#question2").val());
		if(question2.length>0){
			$("#font10").attr("color","green");
			$("#font10").html("<img src=\"images/check_right.gif\"/>&nbsp;");
		}else{
			$("#font10").attr("color","red");
			$("#font10").html("<img src=\"images/check_error.gif\"/>&nbsp;请输入您的第一个提示问题");
		}
	}
	function checkAnaswer2(){
		var answer2 = trim($("#answer2").val());
		if(answer2.length>0){
			$("#font11").attr("color","green");
			$("#font11").html("<img src=\"images/check_right.gif\"/>&nbsp;");
		}else{
			$("#font11").attr("color","red");
			$("#font11").html("<img src=\"images/check_error.gif\"/>&nbsp;请输入您的答案");
		}
	}
	function checkQuestion3() {
		var question3 = trim($("#question3").val());
		if(question3.length>0){
			$("#font12").attr("color","green");
			$("#font12").html("<img src=\"images/check_right.gif\"/>&nbsp;");
		}else{
			$("#font12").attr("color","red");
			$("#font12").html("<img src=\"images/check_error.gif\"/>&nbsp;请输入您的第一个提示问题");
		}
	}
	function checkAnaswer3(){
		var answer3 = trim($("#answer3").val());
		if(answer3.length>0){
			$("#font13").attr("color","green");
			$("#font13").html("<img src=\"images/check_right.gif\"/>&nbsp;");
		}else{
			$("#font13").attr("color","red");
			$("#font13").html("<img src=\"images/check_error.gif\"/>&nbsp;请输入您的答案");
		}
	}
	function send(){

		$.post("changeQuestion",
				{'user.question1':$("#question1").val(),
			'user.question2':$("#question2").val(),
			'user.question3':$("#question3").val(),
			'user.question1':$("#question1").val(),
			'user.answer1':$("#answer1").val(),
			'user.answer2':$("#answer2").val(),
			'user.answer3':$("#answer3").val()}
		,function(data){
			if(data=="true"){
				window.parent.show_Message("修改密码保护问题成功!","green");
				window.parent.tb_remove();
			}else{
				window.parent.show_Message("修改密码保护问题失败!,请稍后再试!","red");
				window.parent.tb_remove();
			}
		},"text")
	}
	</script>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
  
<body>
  <table border="1" width="100%">
        <tr>
          <td height="38" width="20%" bgcolor="#1e84b4" class="STYLE6"><div align="right">问题一：</div></td>
          <td width="40%"><label><input class="STYLE7" type="text" name="user.question1" id="question1" value="${user.question1}" onKeyUp="checkQuestion1()"></label></td>
          <td width="40%"><font id="font8" size="2" color="#808080">请修改问题一</font></td>
    </tr>
        <tr>
          <td height="32" bgcolor="#1e84b4" class="STYLE6"><div align="right">答案：</div></td>
          <td><label><input class="STYLE7" type="text" name="user.answer1" id="answer1"  value="${user.answer1}" onKeyUp="checkAnaswer1()"></label></td>
          <td><font id="font9" size="2" color="#808080">请修改问题答案</font></td>
        </tr>
        <tr>
          <td height="37" bgcolor="#1e84b4" class="STYLE6"><div align="right">问题二：</div></td>
          <td><label><input class="STYLE7" type="text" name="user.question2" id="question2" value="${user.question2}" onKeyUp="checkQuestion2()"></label></td>
          <td><font id="font10" size="2" color="#808080">请修改问题二</font></td>
        </tr>
        <tr>
          <td height="40" bgcolor="#1e84b4" class="STYLE6"><div align="right">答案：</div></td>
          <td><label><input class="STYLE7" type="text" name="user.answer2" id="answer2"  value="${user.answer2}" onKeyUp="checkAnaswer2()"></label></td>
          <td><font id="font11" size="2" color="#808080">请修改问题答案</font></td>
        </tr>
        <tr>
          <td height="42" bgcolor="#1e84b4" class="STYLE6"><div align="right">问题三：</div></td>
          <td><label><input class="STYLE7" type="text" name="user.question3" id="question3"  value="${user.question2}" onKeyUp="checkQuestion3()"></label></td>
          <td><font id="font12" size="2" color="#808080">请修改问题三</font></td>
        </tr>
        <tr>
          <td height="38" bgcolor="#1e84b4" class="STYLE6"><div align="right">答案：</div></td>
          <td><label><input class="STYLE7" type="text" name="user.answer3" id="answer3"  value="${user.answer3}" onKeyUp="checkAnaswer3()"></label></td>
          <td><font id="font13" size="2" color="#808080">请修改问题答案</font></td>
        </tr>
        <tr>
			 <td colspan="2" align="center"><input type="button" id="sub" value="确定" onClick="send()"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" id="reset" value="重填" /></td>
             <td><font id="font4">&nbsp;</font></td>
        </tr>
 </table>  
</body>
</html>
